﻿<!--*************************************************************************************

   Toolkit for WPF

   Copyright (C) 2007-2016 Xceed Software Inc.

   This program is provided to you under the terms of the Microsoft Public
   License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license 

   For more features, controls, and fast professional support,
   pick up the Plus Edition at https://xceed.com/xceed-toolkit-plus-for-wpf/

   Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids

  ***********************************************************************************-->

<local:DemoView x:Class="Xceed.Wpf.Toolkit.LiveExplorer.Samples.TimeSpan.Views.TimeSpanView"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
                xmlns:local="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer"
                xmlns:sys="clr-namespace:System;assembly=mscorlib"
                Title="TimeSpanUpDown">
   <local:DemoView.Description>
      <Paragraph FontSize="14"
                 FontFamily="Segoe">
         The TimeSpanUpDown controls let you increment or decrement a time over 24 hours. The Format is Days.Hours:Minutes:Seconds.Milliseconds.
      </Paragraph>
   </local:DemoView.Description>

   <local:DemoView.Resources>
      <ObjectDataProvider x:Key="enumDateTimePart" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
         <ObjectDataProvider.MethodParameters>
            <x:Type TypeName="xctk:DateTimePart"/>
         </ObjectDataProvider.MethodParameters>
      </ObjectDataProvider>
   </local:DemoView.Resources>

   <Grid>
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>

      <GroupBox Header="Features"
                HorizontalAlignment="Stretch">
         <Grid>
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="Auto" />
               <ColumnDefinition Width="Auto" />
               <ColumnDefinition Width="Auto" />
               <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <!-- 1st column-->
            <TextBlock Text="Watermark:"
                       VerticalAlignment="Center" />
            <TextBox x:Name="_watermark"
                     Grid.Column="1"
                     Text="{Binding Watermark, ElementName=_timeSpanUpDown}"
                     Width="190"
                     HorizontalAlignment="Left"
                     Margin="5,5,25,5" />
            <TextBlock Grid.Row="1"
                       Text="ClipValueToMinMax:"
                       VerticalAlignment="Center" />
            <CheckBox x:Name="_clipValuetoMinMax"
                      Grid.Row="1"
                      Grid.Column="1"
                      IsChecked="{Binding ClipValueToMinMax, ElementName=_timeSpanUpDown}"
                      HorizontalAlignment="Left"
                      VerticalAlignment="Center"
                      Margin="5,5,25,5" />
            <TextBlock Grid.Row="2"
                       Text="FractionalSecondsDigitsCount:"
                       VerticalAlignment="Center" />
            <xctk:IntegerUpDown x:Name="_fractionalSecondsDigitsCount"
                                Grid.Row="2"
                                Grid.Column="1"
                                Value="{Binding FractionalSecondsDigitsCount, ElementName=_timeSpanUpDown}"
                                Maximum="3"
                                Minimum="0"
                                HorizontalAlignment="Left"
                                Margin="5,5,25,5" />
            <TextBlock Grid.Row="3" 
                       Text="CurrentDateTimePart:" 
                       VerticalAlignment="Center"/>
            <ComboBox x:Name="_currentDateTimePart"
                      Grid.Row="3"
                      Grid.Column="1"
                      ItemsSource="{Binding Source={StaticResource enumDateTimePart}}"
                      SelectedItem="{Binding CurrentDateTimePart, ElementName=_timeSpanUpDown}"
                      Margin="5,5,25,5" 
                      ToolTip="Must match a DateTimePart of the TimeSpanUpDown"/>

            <!-- 2nd column-->
            <TextBlock Grid.Column="2"
                       Text="DefaultValue:"
                       VerticalAlignment="Center"
                       Margin="5" />
            <xctk:TimeSpanUpDown x:Name="_defaultValue"
                                 Grid.Column="3"
                                 Value="{Binding DefaultValue, ElementName=_timeSpanUpDown}"
                                 Width="100"
                                 HorizontalAlignment="Left"
                                 VerticalAlignment="Center"
                                 Margin="5,5,25,5" />
            <TextBlock Grid.Row="1"
                       Grid.Column="2"
                       Text="Minimum:"
                       VerticalAlignment="Center"
                       Margin="5" />
            <xctk:TimeSpanUpDown x:Name="_minimum"
                                 Grid.Row="1"
                                 Grid.Column="3"
                                 Value="{Binding Minimum, ElementName=_timeSpanUpDown}"
                                 Width="100"
                                 HorizontalAlignment="Left"
                                 VerticalAlignment="Center"
                                 Margin="5,5,25,5" />
            <TextBlock Grid.Row="2"
                       Grid.Column="2"
                       Text="Maximum:"
                       VerticalAlignment="Center"
                       Margin="5" />
            <xctk:TimeSpanUpDown x:Name="_maximum"
                                 Grid.Row="2"
                                 Grid.Column="3"
                                 Value="{Binding Maximum, ElementName=_timeSpanUpDown}"
                                 Width="100"
                                 HorizontalAlignment="Left"
                                 VerticalAlignment="Center"
                                 Margin="5,5,25,5" />
            <TextBlock Grid.Row="3"
                       Grid.Column="2"
                       Text="Step:"
                       VerticalAlignment="Center"
                       Margin="5" />
            <xctk:IntegerUpDown x:Name="_step"
                                Grid.Row="3"
                                Grid.Column="3"
                                Value="{Binding Step, ElementName=_timeSpanUpDown}"
                                Maximum="10"
                                Minimum="1"
                                Width="100"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                Margin="5,5,25,5" />
         </Grid>
      </GroupBox>

      <StackPanel Grid.Row="1"
                  HorizontalAlignment="Left">
         <TextBlock Text="Usage: "
                    Margin="0,10,0,0"
                    Style="{StaticResource Header}" />
         <xctk:TimeSpanUpDown x:Name="_timeSpanUpDown"
                              Width="300"
                              VerticalAlignment="Top"
                              IsReadOnly="False"
                              Watermark="Enter text"
                              DefaultValue="00:00:00"
                              Maximum="5.00:00:00"
                              Minimum="-5.00:00:00"
                              ClipValueToMinMax="False"
                              FractionalSecondsDigitsCount="0"
                              CurrentDateTimePart="Hour24"
                              Step="1"/>
      </StackPanel>
   </Grid>
</local:DemoView>
